package com.twu.biblioteca;


public class Movie {

    private String name;
    private int year;
    private String director;
    private int rating;

    public Movie(String movieName, int movieYear, String movieDirector, int movieRating){
        name = movieName;
        year = movieYear;
        director = movieDirector;
        rating = movieRating;
    }

    public String getMovieName() {
        return name;
    }

    public int getMovieYear() {
        return year;
    }

    public String getMovieDirector() {
        return director;
    }

    public int getMovieRating() {
        return rating;
    }

    @Override
    public boolean equals(Object objectToCompare){
        if(!(objectToCompare instanceof Movie))
            return false;

        Movie movieToCompare = (Movie) objectToCompare;
        if(name.equals(movieToCompare.getMovieName()) && director.equals(movieToCompare.getMovieDirector()) &&
                year == movieToCompare.getMovieYear() && rating == movieToCompare.getMovieRating())
            return true;

        return false;
    }
}
